const showMsg = (msg)=>{
	uni.showModal({
		content: msg,
		showCancel: false
	});
}
/**
 * 时间范围是否在多少天内
 * @param {Object} startTime 开始时间
 * @param {Object} endTime   结束时间
 * @param {Object} compDay   是否在x天内
 */
export const checkDate = (startTime, endTime, compDay) => {
    if (startTime == "" || startTime == null || startTime == undefined) {
				showMsg('请选择开始时间！')
        return true;
				
    }
    if (endTime == "" || endTime == null || endTime == undefined) {
				showMsg('请选择结束时间！')
        return true;
    }
    var data1 = Date.parse(startTime.replace(/-/g, "/"));
    var data2 = Date.parse(endTime.replace(/-/g, "/"));
    var datadiff = data2 - data1;
    var time = parseInt(compDay) * (60 * 60 * 24 * 1000);
    if (datadiff < 0) {
				showMsg('开始时间应小于结束时间！')
        return true;
    }
    if (datadiff > time) {
				showMsg(`时间间隔大于${parseInt(compDay)}天，请检查!`)
        return true;
    }
    return false;
}

export const checkMonth = (startTime, endTime)=>{
	let sT = new Date(startTime).getMonth()+1
	let eT = new Date(endTime).getMonth()+1
	if(sT != eT){
		showMsg('暂不支持跨月查询!')
		return true
	}
	return false
}